import instance from '@/utils-gongju/request.js'

// 首页轮播图
export const getSwiper = () => {
  return instance.get('/home/swiper')
}
// 租房小组
export const getGroups = () => {
  return instance.get('/home/groups')
}
// 咨询
export const getNews = () => {
  return instance.get('/home/news')
}
// 获取城市列表数据
export const getCityList = () => {
  return instance.get('/area/city', { params: { level: 1 } })
}
// 获取用户信息资料
export const getUsername = () => {
  return instance.get('/user')
}
// 根据条件查询房屋
export const getHouses = (obj) => {
  return instance.get('/houses', {
    params:
    {
      cityId: obj || 'AREA|dbf46d32-7e76-1196',
      area: '' || null,
      subway: '',
      rentType: '',
      // price: obj.price || null,
      more: true || null,
      roomType: '',
      oriented: '',
      characteristic: '',
      floor: ''

    }
  })
}
// 获取房屋查询条件
export const screenHouseList = (id) => {
  return instance.get('/houses/condition', {
    params:
    { id: id || 'AREA|dbf46d32-7e76-1196' }
  })
}
// 查询房屋具体信息
export const HouseDetail = (id) => {
  return instance.get(`/houses/${id}`)
}
// 用户注册接口
export const register = (data) => {
  return instance.post('/user/registered', data)
}
// 用户登录借口
export const login = (data) => {
  return instance.post('/user/login', data)
}
// 添加收藏
export const FavoriteHouse = (id) => {
  return instance.post(`/user/favorites/${id}`)
}
// 删除收藏
export const RemoveFavoriteHouse = (id) => {
  return instance.delete(`/user/favorites/${id}`)
}
// 查看房屋是否收藏
export const WatchFavoriteHouse = (id) => {
  return instance.get(`/user/favorites/${id}`)
}
// 查看收藏列表
export const LookFavoriteHouse = () => {
  return instance.get('/user/favorites/')
}
